package xyz.spoplar.aidlclient;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class SecondActivity extends AppCompatActivity implements View.OnClickListener {

    Button rbtn;
    TextView tv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        Bundle bundle = this.getIntent().getExtras();
        String name = bundle.getString("name");


        Log.d("Tag",name);

        tv = (TextView) findViewById(R.id.textView4);
        tv.setText(name);

        rbtn = (Button) findViewById(R.id.rbtn);

        rbtn.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.rbtn:
                Intent intent = new Intent(SecondActivity.this,MainActivity.class);
                Bundle bundle = new Bundle();
                bundle.putString("send","hello");
                intent.putExtras(bundle);
                SecondActivity.this.setResult(RESULT_OK,intent);
                SecondActivity.this.finish();
                break;
        }
    }
}
